import dataclasses


@dataclasses.dataclass
class Student:
    name: str
    age: int

    def __str__(self):
        return f"name={self.name}, age={self.age}"


student = Student("Alice", 20)
print(student)
print(str(student))

""" 输出:
name=Alice, age=20
name=Alice, age=20
"""
